package com.tuling.base;

import java.util.concurrent.DelayQueue;
import java.util.concurrent.Delayed;
import java.util.concurrent.locks.LockSupport;

public class MutiThreads {
    static Thread t1= null;
    static Thread t2= null;
    static Thread t3= null;
    public static void main(String[] args) {
         t1=new Thread(()->{
             for (int i = 0; i <100 ; i++) {
                 System.out.print(1);
                 LockSupport.unpark(t2);
                 LockSupport.park();
             }
        });


         t2=new Thread(()->{
             for (int i = 0; i <100 ; i++) {
                 LockSupport.park();
                 System.out.print(2);
                 LockSupport.unpark(t3);
             }
        });

         t3=new Thread(()->{
             for (int i = 0; i <10 ; i++) {
                 LockSupport.park();
                 System.out.print(3);
                 System.out.println("===");
                 LockSupport.unpark(t1);
             }
        });

        t1.start();
        t2.start();
        t3.start();


        DelayQueue delayQueue = new DelayQueue();
    }
}
